<?php
/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Badge
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
?>


<?php if( $this->paginator->getTotalItemCount() > 0 ): ?>

  <?php if ($this->display_style == 'side'): ?>
    <ul class='badges_badge_list'>
      <?php foreach ($this->paginator as $award): ?>
        <?php 
          $badge = $award->getBadge(); 
          $photolink = ($this->photolink == 'award') ? $award->getHref() : $badge->getHref();
        ?>
        <li>
          <div class="badge_photo">
            <?php echo $this->htmlLink($photolink, $this->itemPhoto($badge, 'thumb.profile'),
                $badge->getDescription() ? array('class' => 'BadgeAwardTip','title'=>$badge->getTitle(), 'rel'=>$badge->getDescription()) : array()
              ); 
            ?>
          </div>
          <?php if ($this->showtitle): ?>
            <div class='badge_award_title'>
              <?php echo $award->__toString(); ?>
            </div>
          <?php endif; ?>  
          <?php if ($this->showmeta): ?>
            <div class='badge_award_meta'>
              <?php echo $this->translate('Awarded %1$s badge on %2$s', $badge->__toString(), $this->locale()->toDate($award->creation_date)); ?>
                -
                <?php echo $this->translate(array("%s comment", "%s comments", $award->comment_count), $this->locale()->toNumber($award->comment_count)); ?>
                -
                <?php echo $this->translate(array('%1$s like', '%1$s likes', $award->like_count), $this->locale()->toNumber($award->like_count)); ?>
                  -
                  <?php echo $this->translate(array("%s view", "%s view", $award->view_count), $this->locale()->toNumber($award->view_count)); ?>
                  
            </div>
          <?php endif; ?>
          <?php if ($this->showdescription): ?>
            <div class='badge_award_desc'>
              <?php echo $this->viewMore($award->getDescription()); ?>
            </div>
          <?php endif; ?> 
        </li>
      <?php endforeach; ?>  
    </ul>

  <?php else: ?>
    <?php /* PROFILE TAB FORMAT */ ?>
    <ul class='profile_badge_awards badges_awards_list'>
      <?php foreach ($this->paginator as $award): ?>
        <?php 
          $badge = $award->getBadge(); 
          $photolink = ($this->photolink == 'award') ? $award->getHref() : $badge->getHref();
        ?>
      <li>
        <div class='badge_award_photo'>
          <?php echo $this->htmlLink($photolink, $this->itemPhoto($badge, 'thumb.normal'),
            $badge->getDescription() ? array('class' => 'BadgeAwardTip','title'=>$badge->getTitle(), 'rel'=>$badge->getDescription()) : array()
          );?>
        </div>
        <div class='badge_award_info'>
          <?php if ($this->showtitle): ?>
            <div class='badge_award_title'>
              <?php echo $award->__toString(); ?>
            </div>
          <?php endif; ?>  
          <?php if ($this->showmeta): ?>
            <div class='badge_award_meta'>
              <?php echo $this->translate('Awarded %1$s badge on %2$s', $badge->__toString(), $this->locale()->toDate($award->creation_date)); ?>
                -
                <?php echo $this->translate(array("%s comment", "%s comments", $award->comment_count), $this->locale()->toNumber($award->comment_count)); ?>
                -
                <?php echo $this->translate(array('%1$s like', '%1$s likes', $award->like_count), $this->locale()->toNumber($award->like_count)); ?>
            </div>
          <?php endif; ?>
          <?php if ($this->showdescription): ?>
            <div class='badge_award_desc'>
              <?php echo $this->viewMore($award->getDescription()); ?>
            </div>
          <?php endif; ?>  
        </div>
      </li>
      <?php endforeach; ?>
    </ul>
    <div class="badges_profile_actions">
      <?php echo $this->htmlLink(array('route'=>'badge_award_user', 'user_id'=>$this->subject()->getIdentity()), 
        $this->translate('View All Awards'),
        array('class'=>'buttonlink item_icon_badge')
      );?>
    </div>
    <?php /* END - PROFILE TAB FORMAT */ ?>
  <?php endif; ?>
    <script language="Javascript">
    
    en4.core.runonce.add(function(){
      
      var ListBadgeAwardBadgeTip = new Tips($$('.BadgeAwardTip'), {
        initialize:function(){
          this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
        },
        className: 'badge_bubble',
        showDelay: 400,
        hideDelay: 400
      });
      
    });
    </script>  
<?php else: ?>  

  <div class="tip">
    <span>
      <?php echo $this->translate('There are no awards given yet.');?>
    </span>
  </div>
    
<?php endif; ?>  
